#include("/admin/common/header.html")
#include("/admin/common/footer.html")
#include("/admin/common/left.html")
#include("/admin/common/layout.html")

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Myopen</title>
<link rel="stylesheet" href="#(ctx_path)/plugins/layui/css/layui.css">

</head>
<body>
	<div class="layui-layout layui-layout-admin">
	
		#@header()

		<div class="layui-body" style="left:0px;">
			<!-- 内容主体区域 -->
			<div style="width: 90%;" align="center">
				<form class="layui-form" action=""  style="width: 350px;">
			
						<div class="layui-form-item">
							<div class="layui-input-block" align="center" style="font-size: 18px;margin-left: 0px;">
								<br/>
								<br/>
								<br/>
								<b>个人信息修改</b><br/>
							</div>
						</div>
						
						<div class="layui-form-item">
							<label class="layui-form-label">姓名</label>
							<div class="layui-input-block" >
								<input type="text" name="nickname" placeholder="请输入" value="#(vo.nickname)"
									autocomplete="off" class="layui-input" lay-verify="required">
							</div>
						</div>
						
						<div class="layui-form-item">
							<label class="layui-form-label">邮箱</label>
							<div class="layui-input-block" >
								<input type="text" name="email" placeholder="请输入" value="#(vo.email)"
									autocomplete="off" class="layui-input" lay-verify="required|email">
							</div>
						</div>
						
						<div class="layui-form-item">
							<label class="layui-form-label">手机号</label>
							<div class="layui-input-block">
								<input type="text" name="cellphone" placeholder="请输入" value="#(vo.cellphone)"
									autocomplete="off" class="layui-input" lay-verify="required|phone">
							</div>
						</div>
						
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn" type="button" onclick="doUpdateMyInfo();" style="width: 100%;">修改</button>
							</div>
						</div>
						
					</form>
				</div>
			
		</div>

		<div class="layui-footer" style="left:0px;" align="center">
			#@footer()
		</div>
		
	</div>
	
	
	<script src="#(ctx_path)/plugins/layui/layui.js"></script>
	<script src="#(ctx_path)/plugins/jquery/1.11.3/jquery.min.js"></script>
	<script src="#(ctx_path)/plugins/jquery.cookie/jquery.cookie.js"></script>
	<script src="#(ctx_path)/plugins/ckeditor/ckeditor.js"></script>
	<script src="#(ctx_path)/plugins/ckeditor.my/ckeditor.my.js"></script>
	
	<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
	<!--[if lt IE 9]>
	  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
	
	<script type="text/javascript">
		
		layui.config({
			base : '/plugins/layui.custom/' 
		}).extend({ //设定模块别名
			treeSelect : 'treeSelect'
		});

		
	</script>
	
	<script type="text/javascript">
		//注意：导航 依赖 element 模块，否则无法进行功能性操作
		
		layui.use(['element','table','layer','tree','treeSelect','laytpl'], function() {
			var table = layui.table;
			var element = layui.element;
			var table = layui.table;
			var $ = layui.$;
			var layer = layui.layer;
			var tree = layui.tree;
			var laytpl = layui.laytpl;
			
			//…
		});
		
		function doUpdateMyInfo(){
			var nickname=$(":input[name='nickname']").val();
	  		var email=$(":input[name='email']").val();
	  		var cellphone=$(":input[name='cellphone']").val();
	  		
	  		if(nickname==""){
	  			layer.open({
					type : 1,
					content : '<div style="padding: 20px 100px;">请输入姓名</div>',
					btn : '确认',
					btnAlign : 'c',
					shade : 0.5,
					yes : function() {
						layer.closeAll();
					}
				});
	  			return;
	  		}
	  		
	  		if(email==""){
	  			layer.open({
					type : 1,
					content : '<div style="padding: 20px 100px;">请输入邮箱</div>',
					btn : '确认',
					btnAlign : 'c',
					shade : 0.5,
					yes : function() {
						layer.closeAll();
					}
				});
	  			return;
	  		}
	  		if(cellphone==""){
	  			layer.open({
					type : 1,
					content : '<div style="padding: 20px 100px;">请输入手机号</div>',
					btn : '确认',
					btnAlign : 'c',
					shade : 0.5,
					yes : function() {
						layer.closeAll();
					}
				});
	  			return;
	  		}
	  		
	  		
			
			$.ajax({
				type : 'get',
				url : '#(ctx_path)/admin/my/detail/update/action',
				data : $("form").serialize(),
				success : function(data) {
					if (data.code == "0") {
						layer.open({
							type : 1,
							content : '<div style="padding: 20px 100px;">修改成功</div>',
							btn : '确认',
							btnAlign : 'c',
							shade : 0.5,
							yes : function() {
								layer.closeAll();
								window.location.href = '#(ctx_path)/admin';
							}
						});
					} else {
	
					}
				}
			});

		}
	</script>
	
</body>
</html>
